package com.seecen.server.controller;

import com.seecen.server.dao.IBookDao;
import com.seecen.server.pojo.Book;
import com.seecen.server.pojo.User;
import org.apache.ibatis.annotations.ResultMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.UUID;
import java.util.concurrent.TimeUnit;

@RestController
@CrossOrigin // 跨域请求
@RequestMapping("/api/book")
public class BookController {
    @Autowired
    private IBookDao iBookDao;
    @GetMapping("/list")
    public List<Book> list(){return iBookDao.list();}
    @PostMapping("/save")
    public int register(@RequestBody Book book) {
        return iBookDao.save(book);
    }
    @PostMapping("/update")
    public int login(@RequestBody Book book) {
        return iBookDao.update(book);
    }
    @GetMapping("/delete")
    public int delete(@PathVariable("id") Integer id){return iBookDao.delete(id);}
}
